/**
 * @param {number} numRows
 * @return {number[][]}
 */
var generate = function (numRows) {
    const ret = [];
    for (let i = 1; i <= numRows; i++) {
        const row = new Array(i).fill(1);
        console.log(row);
        for (let j = 1; j < row.length - 1; j++) {
            row[j] = ret[i - 2][j - 1] + ret[i - 2][j];
        }
        console.log(row);
        ret.push(row);
    }

    return ret;
};
generate(3);